import request from '/src/axios.js';
import {baseUrl} from "../../config/env";

export const topMenuApi = {
  getList: (current, size, params) => request({
    url: baseUrl + '/api-user/topmenu/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  }),
  getDetail: (id) => request({
    url: baseUrl + '/api-user/topmenu/detail',
    method: 'get',
    params: {
      id
    }
  }),
  remove: (ids) => request({
    url: baseUrl + '/api-user/topmenu/remove',
    method: 'post',
    params: {
      ids,
    }
  }),
  add: (row) => request({
    url: baseUrl + '/api-user/topmenu/save',
    method: 'post',
    data: row
  }),
  update: (row) => request({
    url: baseUrl + '/api-user/topmenu/update',
    method: 'post',
    data: row
  }),
  getMenuTree: () => request({
    url: baseUrl + '/api-user/menus/topMenu',
    method: 'get',
    // data: row
  }),
  grant: (id, menuIds) => request({
    url: baseUrl + '/api-user/topmenu/granted',
    method: 'post',
    data: {
      id,
      menuIds
    }
  }),
  getMenuByTopId: (id) => request({
    url: baseUrl + '/api-user/topmenu/getMenuByTopId',
    method: 'get',
    params: {
      id
    }
  })
}

